import 'dart:convert';

PaymentToken paymentTokenFromJson(String str) =>
    PaymentToken.fromJson(json.decode(str));

String paymentTokenToJson(PaymentToken data) => json.encode(data.toJson());

class PaymentToken {
  PaymentToken({
    this.clientToken,
    this.success,
    this.customerId,
    this.customer,
  });

  String? clientToken;
  bool? success;
  String? customerId;
  Customer? customer;

  factory PaymentToken.fromJson(Map<String, dynamic> json) => PaymentToken(
        clientToken: json["clientToken"],
        success: json["success"],
        customerId: json["customerId"],
        customer: Customer.fromJson(json["customer"]),
      );

  Map<String, dynamic> toJson() => {
        "clientToken": clientToken,
        "success": success,
        "customerId": customerId,
        "customer": customer?.toJson(),
      };
}

class Customer {
  Customer({
    this.createdAt,
    this.updatedAt,
    this.company,
    this.email,
    this.fax,
    this.firstName,
    this.id,
    this.lastName,
    this.phone,
    this.website,
    this.customFields,
    this.creditCards,
    this.applePayCards,
    this.androidPayCards,
    this.amexExpressCheckoutCards,
    this.coinbaseAccounts,
    this.venmoAccounts,
    this.addresses,
    this.payPalAccounts,
    this.paymentMethods,
    this.defaultPaymentMethod,
  });

  int? createdAt;
  int? updatedAt;
  dynamic company;
  String? email;
  dynamic fax;
  String? firstName;
  String? id;
  String? lastName;
  dynamic phone;
  dynamic website;
  CustomFields? customFields;
  List<dynamic>? creditCards;
  List<dynamic>? applePayCards;
  List<dynamic>? androidPayCards;
  List<dynamic>? amexExpressCheckoutCards;
  List<dynamic>? coinbaseAccounts;
  List<dynamic>? venmoAccounts;
  List<dynamic>? addresses;
  List<dynamic>? payPalAccounts;
  List<dynamic>? paymentMethods;
  dynamic defaultPaymentMethod;

  factory Customer.fromJson(Map<String, dynamic> json) => Customer(
        createdAt: json["createdAt"],
        updatedAt: json["updatedAt"],
        company: json["company"],
        email: json["email"],
        fax: json["fax"],
        firstName: json["firstName"],
        id: json["id"],
        lastName: json["lastName"],
        phone: json["phone"],
        website: json["website"],
        customFields: CustomFields.fromJson(json["customFields"]),
        creditCards: List<dynamic>.from(json["creditCards"].map((x) => x)),
        applePayCards: List<dynamic>.from(json["applePayCards"].map((x) => x)),
        androidPayCards:
            List<dynamic>.from(json["androidPayCards"].map((x) => x)),
        amexExpressCheckoutCards:
            List<dynamic>.from(json["amexExpressCheckoutCards"].map((x) => x)),
        coinbaseAccounts:
            List<dynamic>.from(json["coinbaseAccounts"].map((x) => x)),
        venmoAccounts: List<dynamic>.from(json["venmoAccounts"].map((x) => x)),
        addresses: List<dynamic>.from(json["addresses"].map((x) => x)),
        payPalAccounts:
            List<dynamic>.from(json["payPalAccounts"].map((x) => x)),
        paymentMethods:
            List<dynamic>.from(json["paymentMethods"].map((x) => x)),
        defaultPaymentMethod: json["defaultPaymentMethod"],
      );

  Map<String, dynamic> toJson() => {
        "createdAt": createdAt,
        "updatedAt": updatedAt,
        "company": company,
        "email": email,
        "fax": fax,
        "firstName": firstName,
        "id": id,
        "lastName": lastName,
        "phone": phone,
        "website": website,
        "customFields": customFields?.toJson(),
        "creditCards": creditCards != null
            ? List<dynamic>.from(creditCards!.map((x) => x))
            : null,
        "applePayCards": applePayCards != null
            ? List<dynamic>.from(applePayCards!.map((x) => x))
            : null,
        "androidPayCards": androidPayCards != null
            ? List<dynamic>.from(androidPayCards!.map((x) => x))
            : null,
        "amexExpressCheckoutCards": amexExpressCheckoutCards != null
            ? List<dynamic>.from(amexExpressCheckoutCards!.map((x) => x))
            : null,
        "coinbaseAccounts": coinbaseAccounts != null
            ? List<dynamic>.from(coinbaseAccounts!.map((x) => x))
            : null,
        "venmoAccounts": venmoAccounts != null
            ? List<dynamic>.from(venmoAccounts!.map((x) => x))
            : null,
        "addresses": addresses != null
            ? List<dynamic>.from(addresses!.map((x) => x))
            : null,
        "payPalAccounts": payPalAccounts != null
            ? List<dynamic>.from(payPalAccounts!.map((x) => x))
            : null,
        "paymentMethods": paymentMethods != null
            ? List<dynamic>.from(paymentMethods!.map((x) => x))
            : null,
        "defaultPaymentMethod": defaultPaymentMethod,
      };
}

class CustomFields {
  CustomFields();

  factory CustomFields.fromJson(Map<String, dynamic> json) => CustomFields();

  Map<String, dynamic> toJson() => {};
}
